import axios from 'axios'
import qs from 'qs'
import router from "../../router/router";
import iView from "view-design";
import Utils from "../../js/Utils";

export default {
    namespaced: true,
    actions: {
        getAllNotice:function ({commit}, params) {
            let {callback} = params;
            params.onget = ({notices}) => {
                callback(notices);
            };

            commit("getAll", params);
        }
    },

    mutations: {
        getAll: function (state, {title,message,publisher,page = 0,size = 4, onget}) {
            axios.get('/notice',
                {
                    params:{
                        title, message, publisher, page, size
                    }
            }).then(({data}) => {
                onget(data);
            });
        }
    }

}